﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System;
using System.Text;
using LitJson;
using VIP.Extension;

public enum VIPPlatform
{

    Windows,
    Android,
    Web

}

public enum VIPPathEnum
{

    //需要填写全路径
    NONE,
    //项目的Assets文件夹下
    DATA_PATH,
    //项目的StreamingAssets文件夹下（默认路径）
    STREAMING_ASSETS_PATH,
    //与根目录平级
    ROOT_PATH,
    //持久化存储路径
    PERSISTENT_DATA_PATH

}

public class VIPPath {

    /// <summary>
    /// 枚举对应路径字典
    /// </summary>
    private static Dictionary<VIPPathEnum, string> pathDic = new Dictionary<VIPPathEnum, string>();

    /// <summary>
    /// 注册字典
    /// </summary>
    static VIPPath()
    {
        pathDic.Add(VIPPathEnum.NONE, "");
        pathDic.Add(VIPPathEnum.ROOT_PATH, Directory.GetCurrentDirectory());
        pathDic.Add(VIPPathEnum.DATA_PATH, Application.dataPath);
        pathDic.Add(VIPPathEnum.STREAMING_ASSETS_PATH, Application.streamingAssetsPath);
        pathDic.Add(VIPPathEnum.PERSISTENT_DATA_PATH, Application.persistentDataPath);
    }

    /// <summary>
    /// 根据枚举获取路径
    /// </summary>
    /// <param name="pathEnum"></param>
    /// <returns></returns>
    public static string GetPath(VIPPathEnum pathEnum)
    {
        string path = "";
        pathDic.TryGetValue(pathEnum, out path);
        if (path.IsNotEmpty()) {
            return path + "/";
        }
        return path;
    }

}
